import request from '@/utils/request'

// 查询客户信息列表
export function listInfo (query) {
  return request({
    url: '/prod-api/customer/Info/list',
    method: 'get',
    params: query
  })
}

// 查询客户信息详细
export function getInfo (customerUid) {
  return request({
    url: '/prod-api/customer/Info/' + customerUid,
    method: 'get'
  })
}

// 新增客户信息
export function addInfo (data) {
  return request({
    url: '/prod-api/customer/Info',
    method: 'post',
    data: data
  })
}

// 修改客户信息
export function updateInfo (data) {
  return request({
    url: '/prod-api/customer/Info',
    method: 'put',
    data: data
  })
}

// 删除客户信息
export function delInfo (customerUid) {
  return request({
    url: '/prod-api/customer/Info/' + customerUid,
    method: 'delete'
  })
}

// 修改客户状态
export function updateCustomerStatus (customerUid, status) {
  const data = {
    customerUid,
    status
  }
  return request({
    url: '/prod-api/customer/Info/updateCustomerStatus',
    method: 'put',
    data: data
  })
}

/**
 * 根据id查询客户信息
 */
export function getCustomerInfoByids (queryCustomerInfoParams, customerUid) {
  return request({
    url: '/prod-api/customer/Info/getCustomerInfoByids/' + customerUid,
    method: 'get',
    params: queryCustomerInfoParams
  })
}

/**
 * 根据id查询客户绑定等级历史记录
 */
export function getLevelInfoHistory (historyQueryParams, customerUid) {
  return request({
    url: '/prod-api/customer/Info/getLevelInfoHistory/' + customerUid,
    method: 'get',
    params: historyQueryParams
  })
}

/**
 * 根据id查询客户账号信息
 */
export function getCustomerAccount (customerUid) {
  return request({
    url: '/prod-api/customer/Info/getCustomerAccount/' + customerUid,
    method: 'get'
  })
}

/**
 * 锁定或启动账号信息
 */
export function updateAccountStatus (data) {
  return request({
    url: '/prod-api/customer/customerAccount/updateAccountStatus',
    method: 'post',
    data: data
  })
}
/**
 * 锁定或启动指定账号信息
 */
export function updateAccountStatusById (customerAccountUid, accountStatus) {
  const data = {
    customerAccountUid,
    accountStatus
  }
  return request({
    url: '/prod-api/customer/customerAccount/updateAccountStatusById',
    method: 'post',
    data: data
  })
}

/**
 * 查看分享者小程序码
 */
export function getSharecustomerQrCode (customerUid) {
  return request({
    url: '/prod-api/customer/Info/getSharecustomerQrCode/' + customerUid,
    method: 'get'
  })
}

//查询对应用户的卡包集合
export function listBuyRecord (customerUid, query) {
  return request({
    url: '/prod-api/customer/Info/listBuyRecord/' + customerUid,
    method: 'get',
    params: query
  })
}

// 查询客户卡包统计
export function getStatisticsByUid (customerUid) {
  return request({
    url: '/prod-api/customer/Info/getStatisticsByUid/' + customerUid,
    method: 'get'
  })
}

//查询客户各个门店的资金
export function listFundStore (customerUid, query) {
  return request({
    url: '/prod-api/customer/Info/listFundStore/' + customerUid,
    method: 'get',
    params: query
  })
}

// 查询客户资金
export function getFundByUid (customerUid) {
  return request({
    url: '/prod-api/customer/Info/getFundByUid/' + customerUid,
    method: 'get'
  })
}

//查询客户的消费记录
export function listConsumptionByUid (customerUid, query) {
  return request({
    url: '/prod-api/customer/Info/listConsumptionByUid/' + customerUid,
    method: 'get',
    params: query
  })
}


export function myBalanceDetail (customerUid, query) {
  return request({
    url: '/prod-api/customer/Info/myBalanceDetail/' + customerUid,
    method: 'get',
    params: query

  })
}

export function listBalanceChange (customerUid, query) {
  return request({
    url: '/prod-api/customer/Info/listBalanceChange/' + customerUid,
    method: 'get',
    params: query

  })
}

// 查询用户的消费统计
export function getConsumptionStatics (customerUid) {
  return request({
    url: '/prod-api/customer/Info/getConsumptionStatics/' + customerUid,
    method: 'get'
  })
}

//查询客户档案
export function recirdListByUid (customerUid) {
  return request({
    url: '/prod-api/customer/Info/recirdListByUid/' + customerUid,
    method: 'get'
  })
}


//查询客户档案
export function selectListLimitByCustomerId (customerUid) {
  return request({
    url: '/prod-api/customer/Info/selectListLimitByCustomerId/' + customerUid,
    method: 'get'
  })
}





export function categorySelectOptions () {
  return request({
    url: '/prod-api/customer/label/selectOptions',
    method: 'get'
  })
}

export function addOrEditTags (customerId, list) {
  return request({
    url: '/prod-api/customer/Info/customerTags/addOrEdit/' + customerId,
    method: 'post',
    data: list
  })
}

// 修改真实姓名备注
export function changeRealNameRemark (data) {
  return request({
    url: `/prod-api/customer/Info`,
    method: 'put',
    data
  })
}

// 服务记录
export function serviceRecord (customerUid, params) {
  return request({
    url: `/prod-api/customer/Info/weComCustomerArchivesPc/${customerUid}`,
    method: 'get',
    params
  })
}

//获取客户档案里的属性
export function getListArchivesLattice (itemId, subscribeId) {
  return request({
    url: `/prod-api/weCom/listArchivesLatticeByItemId/${itemId}/${subscribeId}`,
    method: 'get'
  })
}

// 用户行为
export function userBehavior (params) {
  return request({
    url: `/prod-api/customer/Info/getBehavior`,
    method: 'get',
    params
  })
}